import java.util.Scanner;

public class Main1288 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        long n=sc.nextLong();
        String strs = "";
        while (n!=0){
            strs=(char)(n%8+'0')+strs;
            n=n/8;
        }
        if (strs==""){
            System.out.println("0");
        }else System.out.println(strs);
    }
}
